package com.base.core.idworker;

public class IdContext {
    /**
     * 策略接口
     */
    private static IdWorkerInterface idStrategy = null;

    /* 私有构造方法，防止被实例化 */
    private IdContext() {}

    public static IdWorkerInterface getInstance(String className) {
        switch (className.toLowerCase()) {
            case "snowflake":
                idStrategy = new SnowflakeStrategy(-1, -1);
                break;
            case "random":
                idStrategy = new RandomStrategy();
                break;
            case "verify":
                idStrategy = new VerifyCodeStrategy();
            case "code":
                idStrategy = new CodeStrategy();
        }
        return idStrategy;
    }
}
